home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
CRON_1
/
STANDARD
/
STRINGUT.H
< prev
next >
Wrap
Text File
|
1991-08-11
|
4KB
|
150 lines
#ifndef _StringUtil_
#define _StringUtil_
#ifndef NULL
#define NULL 0L
#endif
/* WARNING: NumberAppend and NumberAppendLimit both use the NumToString
procedure to convert the supplied number into a string. As a result,
they may both MOVE OR PURGE MEMORY.
*/
void StringAppend(StringPtr SrcStr, StringPtr DestStr);
void StringAppends(StringPtr DestStr, int StringCount, StringPtr FirstString, ...);
void StringAppendLimit(StringPtr SrcStr, StringPtr DestStr, int LengthLimit);
void StringInsert(StringPtr SrcStr, StringPtr DestStr, int DestOffset);
void NumberAppend(long SrcNum, StringPtr DestStr);
void NumberAppendLimit(long SrcNum, StringPtr DestStr, int LengthLimit);
/* ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
String Utilities -- Procedure Summary
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
String Utilities is a set of routines that perform some basic, and
generally handy, operations on Pascal strings in a pleasantly
efficient manner.
Appending Strings
Ñ StringAppend
Ñ StringAppends
Ñ StringAppendLimit
Inserting Strings
Ñ StringInsert
Appending Numbers to Strings
Ñ NumberAppend
Ñ NumberAppendLimit
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
Appending Strings
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
StringAppend
╤╤╤╤╤╤╤╤╤╤╤╤
void StringAppend(StringPtr SrcStr, StringPtr DestStr);
StringAppend appends SrcStr to DestStr, omitting any portions of
SrcStr that will not fit in DestStr.
StringAppends
╤╤╤╤╤╤╤╤╤╤╤╤╤
void StringAppends(StringPtr DestStr, int StringCount,
StringPtr FirstString, ...);
StringAppends appends multiple strings to DestStr. StringCount is
the number of strings to be appended, while FirstString and all
subsequent parameters should be pointers to the strings to be
appended. Any of those StringPtrs which is NULL will be replaced
by a tab character.
StringAppendLimit
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
void StringAppendLimit(StringPtr SrcStr, StringPtr DestStr,
int LengthLimit);
Unlike both StringAppend and StringAppends, StringAppendLimit does
not assume that DestStr is a Str255. StringAppendLimit allows you
to specify the maximum permissible length of DestStr. Other than
that, it operates identically to StringAppend; in fact, StringAppend
is nothing more than a call to StringAppendLimit in which the limit
parameter is 255.
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
Inserting Strings
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
StringInsert
╤╤╤╤╤╤╤╤╤╤╤╤
void StringInsert(StringPtr SrcStr, StringPtr DestStr,
int DestOffset);
StringInsert inserts SrcStr into DestStr at the character position
specified by DestOffset. Calling StringInsert with DestOffset set
to zero, for instance, inserts SrcStr at the beginning of DestStr.
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
Appending Numbers to Strings
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
NumberAppend
╤╤╤╤╤╤╤╤╤╤╤╤
void NumberAppend(long SrcNum, StringPtr DestStr);
NumberAppend converts the number in SrcNum to a string by calling
NumToString and then appends that string to DestStr using the
StringAppend procedure.
NumberAppendLimit
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
void NumberAppendLimit(long SrcNum, StringPtr DestStr,
int LengthLimit);
NumberAppendLimit works just like NumberAppend, but allows you to
specify the maximum length of DestStr in the LengthLimit parameter.
WARNING: NumberAppend and NumberAppendLimit both call NumToString
which can cause memory to be moved or purged.
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
Internet: chrisj@emx.utexas.edu
UUCP: {husc6|uunet}!cs.utexas.edu!ut-emx!chrisj
BitNet: chrisj@utxvm.bitnet
AppleLink: chrisj@emx.utexas.edu@internet#
CompuServe: >INTERNET:chrisj@emx.utexas.edu
US Mail: Chris Johnson, 3311 Red River #305, Austin, TX 78705
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
*/
#endif